{% extends 'base_my_blog.html' %}
{% block title %}
博客
{% endblock %}
{% block content %}
<div class="container-fluid">
    {% for message in messages %}
        <div class="alert alert-success">{{ message }}</div>
    {% endfor %}
    {% for article in articles %}
    <div class="card mt-2 mb-2 border-warning">
        <div class="card-body">
            <h4 class="card-title">
                <span class="badge badge-danger">
                    {{ article.get_category_display }}
                </span>
                <a href="/blog_article_content/{{article.id}}">{{ article.title }}</a>
            </h4>
            <p class="card-text">
                {{ article.content|truncatechars:20 }}
            </p>
            <small>
                {{ article.post_datetime }}
                阅读数：{{ article.read_count }}
            </small>
        </div>
        <div class="card-footer">
            <a href="/article/edit/{{ article.id }}" class="btn btn-primary mt-2">修改文章</a>
            <a href="/article/delete/{{ article.id }}" class="btn btn-danger mt-2">删除文章</a>
        </div>
    </div>
    {% endfor %}
</div>
{% endblock %}